﻿#region Using directives

using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using NetROS.Tiers.Entities;
using NetROS.Tiers.Data;

#endregion

namespace NetROS.Tiers.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="VwPopisPutnihNalogaProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract class VwPopisPutnihNalogaProviderBaseCore : EntityViewProviderBase<VwPopisPutnihNaloga>
	{
		#region Custom Methods
		
		
		#endregion

		#region Helper Functions
		
		/*
		///<summary>
		/// Fill an VList&lt;VwPopisPutnihNaloga&gt; From a DataSet
		///</summary>
		/// <param name="dataSet">the DataSet</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pagelen">number of row.</param>
		///<returns><see chref="VList&lt;VwPopisPutnihNaloga&gt;"/></returns>
		protected static VList&lt;VwPopisPutnihNaloga&gt; Fill(DataSet dataSet, VList<VwPopisPutnihNaloga> rows, int start, int pagelen)
		{
			if (dataSet.Tables.Count == 1)
			{
				return Fill(dataSet.Tables[0], rows, start, pagelen);
			}
			else
			{
				return new VList<VwPopisPutnihNaloga>();
			}	
		}
		
		
		///<summary>
		/// Fill an VList&lt;VwPopisPutnihNaloga&gt; From a DataTable
		///</summary>
		/// <param name="dataTable">the DataTable that hold the data.</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pagelen">number of row.</param>
		///<returns><see chref="VList<VwPopisPutnihNaloga>"/></returns>
		protected static VList&lt;VwPopisPutnihNaloga&gt; Fill(DataTable dataTable, VList<VwPopisPutnihNaloga> rows, int start, int pagelen)
		{
			int recordnum = 0;
			
			System.Collections.IEnumerator dataRows =  dataTable.Rows.GetEnumerator();
			
			while (dataRows.MoveNext() && (pagelen != 0))
			{
				if(recordnum >= start)
				{
					DataRow row = (DataRow)dataRows.Current;
				
					VwPopisPutnihNaloga c = new VwPopisPutnihNaloga();
					c.ID = (Convert.IsDBNull(row["ID"]))?(int)0:(System.Int32)row["ID"];
					c.PutniNalogStatus = (Convert.IsDBNull(row["PutniNalogStatus"]))?string.Empty:(System.String)row["PutniNalogStatus"];
					c.IDStatus = (Convert.IsDBNull(row["IDStatus"]))?(int)0:(System.Int32)row["IDStatus"];
					c.RedBr = (Convert.IsDBNull(row["RedBr"]))?(int)0:(System.Int32?)row["RedBr"];
					c.Oznaka = (Convert.IsDBNull(row["Oznaka"]))?string.Empty:(System.String)row["Oznaka"];
					c.Djelatnik = (Convert.IsDBNull(row["Djelatnik"]))?string.Empty:(System.String)row["Djelatnik"];
					c.Datum = (Convert.IsDBNull(row["Datum"]))?DateTime.MinValue:(System.DateTime)row["Datum"];
					c.DatumObracuna = (Convert.IsDBNull(row["DatumObracuna"]))?DateTime.MinValue:(System.DateTime?)row["DatumObracuna"];
					c.DatumBlagajna = (Convert.IsDBNull(row["DatumBlagajna"]))?DateTime.MinValue:(System.DateTime?)row["DatumBlagajna"];
					c.ZadnjiDatumAkontacije = (Convert.IsDBNull(row["ZadnjiDatumAkontacije"]))?DateTime.MinValue:(System.DateTime?)row["ZadnjiDatumAkontacije"];
					c.Napomena = (Convert.IsDBNull(row["Napomena"]))?string.Empty:(System.String)row["Napomena"];
					c.Opis = (Convert.IsDBNull(row["Opis"]))?string.Empty:(System.String)row["Opis"];
					c.PredvidenoTrajanjeDana = (Convert.IsDBNull(row["PredvidenoTrajanjeDana"]))?0:(System.Decimal?)row["PredvidenoTrajanjeDana"];
					c.Akontacija = (Convert.IsDBNull(row["akontacija"]))?0:(System.Decimal)row["akontacija"];
					c.Dnevnice = (Convert.IsDBNull(row["dnevnice"]))?0:(System.Decimal)row["dnevnice"];
					c.Ostalo = (Convert.IsDBNull(row["ostalo"]))?0:(System.Decimal)row["ostalo"];
					c.Prijevoz = (Convert.IsDBNull(row["prijevoz"]))?0:(System.Decimal)row["prijevoz"];
					c.Ukupno = (Convert.IsDBNull(row["Ukupno"]))?0:(System.Decimal?)row["Ukupno"];
					c.DatumOdlaska = (Convert.IsDBNull(row["DatumOdlaska"]))?DateTime.MinValue:(System.DateTime?)row["DatumOdlaska"];
					c.DatumDolaska = (Convert.IsDBNull(row["DatumDolaska"]))?DateTime.MinValue:(System.DateTime?)row["DatumDolaska"];
					c.IDDjelatnikBlagajna = (Convert.IsDBNull(row["IDDjelatnikBlagajna"]))?(int)0:(System.Int32?)row["IDDjelatnikBlagajna"];
					c.DjelatnikBlagajnaPrikaznoIme = (Convert.IsDBNull(row["DjelatnikBlagajnaPrikaznoIme"]))?string.Empty:(System.String)row["DjelatnikBlagajnaPrikaznoIme"];
					c.IDDjelatnikLikvidirao = (Convert.IsDBNull(row["IDDjelatnikLikvidirao"]))?(int)0:(System.Int32?)row["IDDjelatnikLikvidirao"];
					c.DjelatnikLikvidiraoPrikaznoIme = (Convert.IsDBNull(row["DjelatnikLikvidiraoPrikaznoIme"]))?string.Empty:(System.String)row["DjelatnikLikvidiraoPrikaznoIme"];
					c.IDDjelatnikOdobrio = (Convert.IsDBNull(row["IDDjelatnikOdobrio"]))?(int)0:(System.Int32?)row["IDDjelatnikOdobrio"];
					c.DjelatnikOdobrioPrikaznoIme = (Convert.IsDBNull(row["DjelatnikOdobrioPrikaznoIme"]))?string.Empty:(System.String)row["DjelatnikOdobrioPrikaznoIme"];
					c.AcceptChanges();
					rows.Add(c);
					pagelen -= 1;
				}
				recordnum += 1;
			}
			return rows;
		}
		*/	
						
		///<summary>
		/// Fill an <see cref="VList&lt;VwPopisPutnihNaloga&gt;"/> From a DataReader.
		///</summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pageLength">number of row.</param>
		///<returns>a <see cref="VList&lt;VwPopisPutnihNaloga&gt;"/></returns>
		protected VList<VwPopisPutnihNaloga> Fill(IDataReader reader, VList<VwPopisPutnihNaloga> rows, int start, int pageLength)
		{
			int recordnum = 0;
			while (reader.Read() && (pageLength != 0))
			{
				if(recordnum >= start)
				{
					VwPopisPutnihNaloga entity = null;
					if (DataRepository.Provider.UseEntityFactory)
					{
						entity = EntityManager.CreateViewEntity<VwPopisPutnihNaloga>("VwPopisPutnihNaloga",  DataRepository.Provider.EntityCreationalFactoryType); 
					}
					else
					{
						entity = new VwPopisPutnihNaloga();
					}
					entity.ID = (System.Int32)reader["ID"];
					//entity.ID = (Convert.IsDBNull(reader["ID"]))?(int)0:(System.Int32)reader["ID"];
					entity.PutniNalogStatus = reader.IsDBNull(reader.GetOrdinal("PutniNalogStatus")) ? null : (System.String)reader["PutniNalogStatus"];
					//entity.PutniNalogStatus = (Convert.IsDBNull(reader["PutniNalogStatus"]))?string.Empty:(System.String)reader["PutniNalogStatus"];
					entity.IDStatus = (System.Int32)reader["IDStatus"];
					//entity.IDStatus = (Convert.IsDBNull(reader["IDStatus"]))?(int)0:(System.Int32)reader["IDStatus"];
					entity.RedBr = reader.IsDBNull(reader.GetOrdinal("RedBr")) ? null : (System.Int32?)reader["RedBr"];
					//entity.RedBr = (Convert.IsDBNull(reader["RedBr"]))?(int)0:(System.Int32?)reader["RedBr"];
					entity.Oznaka = (System.String)reader["Oznaka"];
					//entity.Oznaka = (Convert.IsDBNull(reader["Oznaka"]))?string.Empty:(System.String)reader["Oznaka"];
					entity.Djelatnik = (System.String)reader["Djelatnik"];
					//entity.Djelatnik = (Convert.IsDBNull(reader["Djelatnik"]))?string.Empty:(System.String)reader["Djelatnik"];
					entity.Datum = (System.DateTime)reader["Datum"];
					//entity.Datum = (Convert.IsDBNull(reader["Datum"]))?DateTime.MinValue:(System.DateTime)reader["Datum"];
					entity.DatumObracuna = reader.IsDBNull(reader.GetOrdinal("DatumObracuna")) ? null : (System.DateTime?)reader["DatumObracuna"];
					//entity.DatumObracuna = (Convert.IsDBNull(reader["DatumObracuna"]))?DateTime.MinValue:(System.DateTime?)reader["DatumObracuna"];
					entity.DatumBlagajna = reader.IsDBNull(reader.GetOrdinal("DatumBlagajna")) ? null : (System.DateTime?)reader["DatumBlagajna"];
					//entity.DatumBlagajna = (Convert.IsDBNull(reader["DatumBlagajna"]))?DateTime.MinValue:(System.DateTime?)reader["DatumBlagajna"];
					entity.ZadnjiDatumAkontacije = reader.IsDBNull(reader.GetOrdinal("ZadnjiDatumAkontacije")) ? null : (System.DateTime?)reader["ZadnjiDatumAkontacije"];
					//entity.ZadnjiDatumAkontacije = (Convert.IsDBNull(reader["ZadnjiDatumAkontacije"]))?DateTime.MinValue:(System.DateTime?)reader["ZadnjiDatumAkontacije"];
					entity.Napomena = reader.IsDBNull(reader.GetOrdinal("Napomena")) ? null : (System.String)reader["Napomena"];
					//entity.Napomena = (Convert.IsDBNull(reader["Napomena"]))?string.Empty:(System.String)reader["Napomena"];
					entity.Opis = reader.IsDBNull(reader.GetOrdinal("Opis")) ? null : (System.String)reader["Opis"];
					//entity.Opis = (Convert.IsDBNull(reader["Opis"]))?string.Empty:(System.String)reader["Opis"];
					entity.PredvidenoTrajanjeDana = reader.IsDBNull(reader.GetOrdinal("PredvidenoTrajanjeDana")) ? null : (System.Decimal?)reader["PredvidenoTrajanjeDana"];
					//entity.PredvidenoTrajanjeDana = (Convert.IsDBNull(reader["PredvidenoTrajanjeDana"]))?0:(System.Decimal?)reader["PredvidenoTrajanjeDana"];
					entity.Akontacija = (System.Decimal)reader["akontacija"];
					//entity.Akontacija = (Convert.IsDBNull(reader["akontacija"]))?0:(System.Decimal)reader["akontacija"];
					entity.Dnevnice = (System.Decimal)reader["dnevnice"];
					//entity.Dnevnice = (Convert.IsDBNull(reader["dnevnice"]))?0:(System.Decimal)reader["dnevnice"];
					entity.Ostalo = (System.Decimal)reader["ostalo"];
					//entity.Ostalo = (Convert.IsDBNull(reader["ostalo"]))?0:(System.Decimal)reader["ostalo"];
					entity.Prijevoz = (System.Decimal)reader["prijevoz"];
					//entity.Prijevoz = (Convert.IsDBNull(reader["prijevoz"]))?0:(System.Decimal)reader["prijevoz"];
					entity.Ukupno = reader.IsDBNull(reader.GetOrdinal("Ukupno")) ? null : (System.Decimal?)reader["Ukupno"];
					//entity.Ukupno = (Convert.IsDBNull(reader["Ukupno"]))?0:(System.Decimal?)reader["Ukupno"];
					entity.DatumOdlaska = reader.IsDBNull(reader.GetOrdinal("DatumOdlaska")) ? null : (System.DateTime?)reader["DatumOdlaska"];
					//entity.DatumOdlaska = (Convert.IsDBNull(reader["DatumOdlaska"]))?DateTime.MinValue:(System.DateTime?)reader["DatumOdlaska"];
					entity.DatumDolaska = reader.IsDBNull(reader.GetOrdinal("DatumDolaska")) ? null : (System.DateTime?)reader["DatumDolaska"];
					//entity.DatumDolaska = (Convert.IsDBNull(reader["DatumDolaska"]))?DateTime.MinValue:(System.DateTime?)reader["DatumDolaska"];
					entity.IDDjelatnikBlagajna = reader.IsDBNull(reader.GetOrdinal("IDDjelatnikBlagajna")) ? null : (System.Int32?)reader["IDDjelatnikBlagajna"];
					//entity.IDDjelatnikBlagajna = (Convert.IsDBNull(reader["IDDjelatnikBlagajna"]))?(int)0:(System.Int32?)reader["IDDjelatnikBlagajna"];
					entity.DjelatnikBlagajnaPrikaznoIme = reader.IsDBNull(reader.GetOrdinal("DjelatnikBlagajnaPrikaznoIme")) ? null : (System.String)reader["DjelatnikBlagajnaPrikaznoIme"];
					//entity.DjelatnikBlagajnaPrikaznoIme = (Convert.IsDBNull(reader["DjelatnikBlagajnaPrikaznoIme"]))?string.Empty:(System.String)reader["DjelatnikBlagajnaPrikaznoIme"];
					entity.IDDjelatnikLikvidirao = reader.IsDBNull(reader.GetOrdinal("IDDjelatnikLikvidirao")) ? null : (System.Int32?)reader["IDDjelatnikLikvidirao"];
					//entity.IDDjelatnikLikvidirao = (Convert.IsDBNull(reader["IDDjelatnikLikvidirao"]))?(int)0:(System.Int32?)reader["IDDjelatnikLikvidirao"];
					entity.DjelatnikLikvidiraoPrikaznoIme = reader.IsDBNull(reader.GetOrdinal("DjelatnikLikvidiraoPrikaznoIme")) ? null : (System.String)reader["DjelatnikLikvidiraoPrikaznoIme"];
					//entity.DjelatnikLikvidiraoPrikaznoIme = (Convert.IsDBNull(reader["DjelatnikLikvidiraoPrikaznoIme"]))?string.Empty:(System.String)reader["DjelatnikLikvidiraoPrikaznoIme"];
					entity.IDDjelatnikOdobrio = reader.IsDBNull(reader.GetOrdinal("IDDjelatnikOdobrio")) ? null : (System.Int32?)reader["IDDjelatnikOdobrio"];
					//entity.IDDjelatnikOdobrio = (Convert.IsDBNull(reader["IDDjelatnikOdobrio"]))?(int)0:(System.Int32?)reader["IDDjelatnikOdobrio"];
					entity.DjelatnikOdobrioPrikaznoIme = reader.IsDBNull(reader.GetOrdinal("DjelatnikOdobrioPrikaznoIme")) ? null : (System.String)reader["DjelatnikOdobrioPrikaznoIme"];
					//entity.DjelatnikOdobrioPrikaznoIme = (Convert.IsDBNull(reader["DjelatnikOdobrioPrikaznoIme"]))?string.Empty:(System.String)reader["DjelatnikOdobrioPrikaznoIme"];
					entity.AcceptChanges();
					rows.Add(entity);
					pageLength -= 1;
				}
				recordnum += 1;
			}
			return rows;
		}
		
		
		/// <summary>
		/// Refreshes the <see cref="VwPopisPutnihNaloga"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="VwPopisPutnihNaloga"/> object to refresh.</param>
		protected void RefreshEntity(IDataReader reader, VwPopisPutnihNaloga entity)
		{
			reader.Read();
			entity.ID = (System.Int32)reader["ID"];
			//entity.ID = (Convert.IsDBNull(reader["ID"]))?(int)0:(System.Int32)reader["ID"];
			entity.PutniNalogStatus = reader.IsDBNull(reader.GetOrdinal("PutniNalogStatus")) ? null : (System.String)reader["PutniNalogStatus"];
			//entity.PutniNalogStatus = (Convert.IsDBNull(reader["PutniNalogStatus"]))?string.Empty:(System.String)reader["PutniNalogStatus"];
			entity.IDStatus = (System.Int32)reader["IDStatus"];
			//entity.IDStatus = (Convert.IsDBNull(reader["IDStatus"]))?(int)0:(System.Int32)reader["IDStatus"];
			entity.RedBr = reader.IsDBNull(reader.GetOrdinal("RedBr")) ? null : (System.Int32?)reader["RedBr"];
			//entity.RedBr = (Convert.IsDBNull(reader["RedBr"]))?(int)0:(System.Int32?)reader["RedBr"];
			entity.Oznaka = (System.String)reader["Oznaka"];
			//entity.Oznaka = (Convert.IsDBNull(reader["Oznaka"]))?string.Empty:(System.String)reader["Oznaka"];
			entity.Djelatnik = (System.String)reader["Djelatnik"];
			//entity.Djelatnik = (Convert.IsDBNull(reader["Djelatnik"]))?string.Empty:(System.String)reader["Djelatnik"];
			entity.Datum = (System.DateTime)reader["Datum"];
			//entity.Datum = (Convert.IsDBNull(reader["Datum"]))?DateTime.MinValue:(System.DateTime)reader["Datum"];
			entity.DatumObracuna = reader.IsDBNull(reader.GetOrdinal("DatumObracuna")) ? null : (System.DateTime?)reader["DatumObracuna"];
			//entity.DatumObracuna = (Convert.IsDBNull(reader["DatumObracuna"]))?DateTime.MinValue:(System.DateTime?)reader["DatumObracuna"];
			entity.DatumBlagajna = reader.IsDBNull(reader.GetOrdinal("DatumBlagajna")) ? null : (System.DateTime?)reader["DatumBlagajna"];
			//entity.DatumBlagajna = (Convert.IsDBNull(reader["DatumBlagajna"]))?DateTime.MinValue:(System.DateTime?)reader["DatumBlagajna"];
			entity.ZadnjiDatumAkontacije = reader.IsDBNull(reader.GetOrdinal("ZadnjiDatumAkontacije")) ? null : (System.DateTime?)reader["ZadnjiDatumAkontacije"];
			//entity.ZadnjiDatumAkontacije = (Convert.IsDBNull(reader["ZadnjiDatumAkontacije"]))?DateTime.MinValue:(System.DateTime?)reader["ZadnjiDatumAkontacije"];
			entity.Napomena = reader.IsDBNull(reader.GetOrdinal("Napomena")) ? null : (System.String)reader["Napomena"];
			//entity.Napomena = (Convert.IsDBNull(reader["Napomena"]))?string.Empty:(System.String)reader["Napomena"];
			entity.Opis = reader.IsDBNull(reader.GetOrdinal("Opis")) ? null : (System.String)reader["Opis"];
			//entity.Opis = (Convert.IsDBNull(reader["Opis"]))?string.Empty:(System.String)reader["Opis"];
			entity.PredvidenoTrajanjeDana = reader.IsDBNull(reader.GetOrdinal("PredvidenoTrajanjeDana")) ? null : (System.Decimal?)reader["PredvidenoTrajanjeDana"];
			//entity.PredvidenoTrajanjeDana = (Convert.IsDBNull(reader["PredvidenoTrajanjeDana"]))?0:(System.Decimal?)reader["PredvidenoTrajanjeDana"];
			entity.Akontacija = (System.Decimal)reader["akontacija"];
			//entity.Akontacija = (Convert.IsDBNull(reader["akontacija"]))?0:(System.Decimal)reader["akontacija"];
			entity.Dnevnice = (System.Decimal)reader["dnevnice"];
			//entity.Dnevnice = (Convert.IsDBNull(reader["dnevnice"]))?0:(System.Decimal)reader["dnevnice"];
			entity.Ostalo = (System.Decimal)reader["ostalo"];
			//entity.Ostalo = (Convert.IsDBNull(reader["ostalo"]))?0:(System.Decimal)reader["ostalo"];
			entity.Prijevoz = (System.Decimal)reader["prijevoz"];
			//entity.Prijevoz = (Convert.IsDBNull(reader["prijevoz"]))?0:(System.Decimal)reader["prijevoz"];
			entity.Ukupno = reader.IsDBNull(reader.GetOrdinal("Ukupno")) ? null : (System.Decimal?)reader["Ukupno"];
			//entity.Ukupno = (Convert.IsDBNull(reader["Ukupno"]))?0:(System.Decimal?)reader["Ukupno"];
			entity.DatumOdlaska = reader.IsDBNull(reader.GetOrdinal("DatumOdlaska")) ? null : (System.DateTime?)reader["DatumOdlaska"];
			//entity.DatumOdlaska = (Convert.IsDBNull(reader["DatumOdlaska"]))?DateTime.MinValue:(System.DateTime?)reader["DatumOdlaska"];
			entity.DatumDolaska = reader.IsDBNull(reader.GetOrdinal("DatumDolaska")) ? null : (System.DateTime?)reader["DatumDolaska"];
			//entity.DatumDolaska = (Convert.IsDBNull(reader["DatumDolaska"]))?DateTime.MinValue:(System.DateTime?)reader["DatumDolaska"];
			entity.IDDjelatnikBlagajna = reader.IsDBNull(reader.GetOrdinal("IDDjelatnikBlagajna")) ? null : (System.Int32?)reader["IDDjelatnikBlagajna"];
			//entity.IDDjelatnikBlagajna = (Convert.IsDBNull(reader["IDDjelatnikBlagajna"]))?(int)0:(System.Int32?)reader["IDDjelatnikBlagajna"];
			entity.DjelatnikBlagajnaPrikaznoIme = reader.IsDBNull(reader.GetOrdinal("DjelatnikBlagajnaPrikaznoIme")) ? null : (System.String)reader["DjelatnikBlagajnaPrikaznoIme"];
			//entity.DjelatnikBlagajnaPrikaznoIme = (Convert.IsDBNull(reader["DjelatnikBlagajnaPrikaznoIme"]))?string.Empty:(System.String)reader["DjelatnikBlagajnaPrikaznoIme"];
			entity.IDDjelatnikLikvidirao = reader.IsDBNull(reader.GetOrdinal("IDDjelatnikLikvidirao")) ? null : (System.Int32?)reader["IDDjelatnikLikvidirao"];
			//entity.IDDjelatnikLikvidirao = (Convert.IsDBNull(reader["IDDjelatnikLikvidirao"]))?(int)0:(System.Int32?)reader["IDDjelatnikLikvidirao"];
			entity.DjelatnikLikvidiraoPrikaznoIme = reader.IsDBNull(reader.GetOrdinal("DjelatnikLikvidiraoPrikaznoIme")) ? null : (System.String)reader["DjelatnikLikvidiraoPrikaznoIme"];
			//entity.DjelatnikLikvidiraoPrikaznoIme = (Convert.IsDBNull(reader["DjelatnikLikvidiraoPrikaznoIme"]))?string.Empty:(System.String)reader["DjelatnikLikvidiraoPrikaznoIme"];
			entity.IDDjelatnikOdobrio = reader.IsDBNull(reader.GetOrdinal("IDDjelatnikOdobrio")) ? null : (System.Int32?)reader["IDDjelatnikOdobrio"];
			//entity.IDDjelatnikOdobrio = (Convert.IsDBNull(reader["IDDjelatnikOdobrio"]))?(int)0:(System.Int32?)reader["IDDjelatnikOdobrio"];
			entity.DjelatnikOdobrioPrikaznoIme = reader.IsDBNull(reader.GetOrdinal("DjelatnikOdobrioPrikaznoIme")) ? null : (System.String)reader["DjelatnikOdobrioPrikaznoIme"];
			//entity.DjelatnikOdobrioPrikaznoIme = (Convert.IsDBNull(reader["DjelatnikOdobrioPrikaznoIme"]))?string.Empty:(System.String)reader["DjelatnikOdobrioPrikaznoIme"];
			reader.Close();
	
			entity.AcceptChanges();
		}
		
		/*
		/// <summary>
		/// Refreshes the <see cref="VwPopisPutnihNaloga"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="VwPopisPutnihNaloga"/> object.</param>
		protected static void RefreshEntity(DataSet dataSet, VwPopisPutnihNaloga entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.ID = (Convert.IsDBNull(dataRow["ID"]))?(int)0:(System.Int32)dataRow["ID"];
			entity.PutniNalogStatus = (Convert.IsDBNull(dataRow["PutniNalogStatus"]))?string.Empty:(System.String)dataRow["PutniNalogStatus"];
			entity.IDStatus = (Convert.IsDBNull(dataRow["IDStatus"]))?(int)0:(System.Int32)dataRow["IDStatus"];
			entity.RedBr = (Convert.IsDBNull(dataRow["RedBr"]))?(int)0:(System.Int32?)dataRow["RedBr"];
			entity.Oznaka = (Convert.IsDBNull(dataRow["Oznaka"]))?string.Empty:(System.String)dataRow["Oznaka"];
			entity.Djelatnik = (Convert.IsDBNull(dataRow["Djelatnik"]))?string.Empty:(System.String)dataRow["Djelatnik"];
			entity.Datum = (Convert.IsDBNull(dataRow["Datum"]))?DateTime.MinValue:(System.DateTime)dataRow["Datum"];
			entity.DatumObracuna = (Convert.IsDBNull(dataRow["DatumObracuna"]))?DateTime.MinValue:(System.DateTime?)dataRow["DatumObracuna"];
			entity.DatumBlagajna = (Convert.IsDBNull(dataRow["DatumBlagajna"]))?DateTime.MinValue:(System.DateTime?)dataRow["DatumBlagajna"];
			entity.ZadnjiDatumAkontacije = (Convert.IsDBNull(dataRow["ZadnjiDatumAkontacije"]))?DateTime.MinValue:(System.DateTime?)dataRow["ZadnjiDatumAkontacije"];
			entity.Napomena = (Convert.IsDBNull(dataRow["Napomena"]))?string.Empty:(System.String)dataRow["Napomena"];
			entity.Opis = (Convert.IsDBNull(dataRow["Opis"]))?string.Empty:(System.String)dataRow["Opis"];
			entity.PredvidenoTrajanjeDana = (Convert.IsDBNull(dataRow["PredvidenoTrajanjeDana"]))?0:(System.Decimal?)dataRow["PredvidenoTrajanjeDana"];
			entity.Akontacija = (Convert.IsDBNull(dataRow["akontacija"]))?0:(System.Decimal)dataRow["akontacija"];
			entity.Dnevnice = (Convert.IsDBNull(dataRow["dnevnice"]))?0:(System.Decimal)dataRow["dnevnice"];
			entity.Ostalo = (Convert.IsDBNull(dataRow["ostalo"]))?0:(System.Decimal)dataRow["ostalo"];
			entity.Prijevoz = (Convert.IsDBNull(dataRow["prijevoz"]))?0:(System.Decimal)dataRow["prijevoz"];
			entity.Ukupno = (Convert.IsDBNull(dataRow["Ukupno"]))?0:(System.Decimal?)dataRow["Ukupno"];
			entity.DatumOdlaska = (Convert.IsDBNull(dataRow["DatumOdlaska"]))?DateTime.MinValue:(System.DateTime?)dataRow["DatumOdlaska"];
			entity.DatumDolaska = (Convert.IsDBNull(dataRow["DatumDolaska"]))?DateTime.MinValue:(System.DateTime?)dataRow["DatumDolaska"];
			entity.IDDjelatnikBlagajna = (Convert.IsDBNull(dataRow["IDDjelatnikBlagajna"]))?(int)0:(System.Int32?)dataRow["IDDjelatnikBlagajna"];
			entity.DjelatnikBlagajnaPrikaznoIme = (Convert.IsDBNull(dataRow["DjelatnikBlagajnaPrikaznoIme"]))?string.Empty:(System.String)dataRow["DjelatnikBlagajnaPrikaznoIme"];
			entity.IDDjelatnikLikvidirao = (Convert.IsDBNull(dataRow["IDDjelatnikLikvidirao"]))?(int)0:(System.Int32?)dataRow["IDDjelatnikLikvidirao"];
			entity.DjelatnikLikvidiraoPrikaznoIme = (Convert.IsDBNull(dataRow["DjelatnikLikvidiraoPrikaznoIme"]))?string.Empty:(System.String)dataRow["DjelatnikLikvidiraoPrikaznoIme"];
			entity.IDDjelatnikOdobrio = (Convert.IsDBNull(dataRow["IDDjelatnikOdobrio"]))?(int)0:(System.Int32?)dataRow["IDDjelatnikOdobrio"];
			entity.DjelatnikOdobrioPrikaznoIme = (Convert.IsDBNull(dataRow["DjelatnikOdobrioPrikaznoIme"]))?string.Empty:(System.String)dataRow["DjelatnikOdobrioPrikaznoIme"];
			entity.AcceptChanges();
		}
		*/
			
		#endregion Helper Functions
	}//end class

	#region VwPopisPutnihNalogaFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;EntityColumn&gt;"/> class
	/// that is used exclusively with a <see cref="VwPopisPutnihNaloga"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class VwPopisPutnihNalogaFilterBuilder : SqlFilterBuilder<VwPopisPutnihNalogaColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the VwPopisPutnihNalogaFilterBuilder class.
		/// </summary>
		public VwPopisPutnihNalogaFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the VwPopisPutnihNalogaFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public VwPopisPutnihNalogaFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the VwPopisPutnihNalogaFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public VwPopisPutnihNalogaFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion VwPopisPutnihNalogaFilterBuilder

	#region VwPopisPutnihNalogaParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;EntityColumn&gt;"/> class
	/// that is used exclusively with a <see cref="VwPopisPutnihNaloga"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class VwPopisPutnihNalogaParameterBuilder : ParameterizedSqlFilterBuilder<VwPopisPutnihNalogaColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the VwPopisPutnihNalogaParameterBuilder class.
		/// </summary>
		public VwPopisPutnihNalogaParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the VwPopisPutnihNalogaParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public VwPopisPutnihNalogaParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the VwPopisPutnihNalogaParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public VwPopisPutnihNalogaParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion VwPopisPutnihNalogaParameterBuilder
} // end namespace
